const tokenName = "SMICToken";
const langsName = "SMICLangs";
function setLocalStorage(name: string, value: any) {
  localStorage.setItem(name, value);
  return new Promise((res) => res(true));
}
function getLocalStorage(name: string) {
  if (localStorage.getItem(name) == null) return "";
  return localStorage.getItem(name);
}
function removeLocalStorage(name: string) {
  return localStorage.removeItem(name);
}

function setToken(value: string) {
  localStorage.setItem(tokenName, value);
}
function getToken() {
  return localStorage.getItem(tokenName);
}
function removeToken() {
  return localStorage.removeItem(tokenName);
}
function setLangs(value: string) {
  localStorage.setItem(langsName, value);
}
function getLangs() {
  return localStorage.getItem(langsName);
}
function removeLangs() {
  return localStorage.removeItem(langsName);
}
export {
  setLocalStorage,
  getLocalStorage,
  setToken,
  getToken,
  removeToken,
  removeLocalStorage,
  setLangs,
  getLangs,
  removeLangs,
};
